#ifndef _SIMPLE_EPOLL_HPP_20120407
#define _SIMPLE_EPOLL_HPP_20120407

#include "base.hpp"

namespace mina
{
	class SimpleEpoll
	{
		public:
			SimpleEpoll(int maxfds);
			~SimpleEpoll();

			int close();
			int init(int maxfds);
			
			int add(int fd, unsigned int events, void * conn);
			int mod(int fd, unsigned int events, void * conn);
			int del(int fd);
			int wait(long timeout);

			int next(void *& conn, unsigned int & op);

			// @TODO interrupt fd (pipe)
		public:
			int _epfd;
			int _maxfds;
			struct epoll_event* _revents;

			int _next_idx;
			int _last_idx;
	};

}

#endif

